package cn.ml.gaoJi.jiHe.list.erChaShu;

public class MyLinked {

    private int count;

    private CheXiang tou;
    private CheXiang wei;

    class CheXiang{
        private int date;
        private CheXiang next;
    }

    public void add(int i) {
        count++;
        CheXiang xiang = new CheXiang();
        xiang.date = i;
        if(tou == null){
            tou = xiang;
        }else {
            wei.next = xiang;
        }
        wei = xiang;
    }


    public int size() {
        return count;
    }

    public int get(int i) {
        CheXiang p = tou;
        for(int j=0;j<i;j++){
            p = p.next;
        }
        return p.date;
    }
}
